package tcln.gxtx.client.widget.grid.renderer.html;

import tcln.gxtx.client.widget.treegrid.AbstractTreeGrid;
import tcln.gxtx.client.widget.treegrid.model.AbstractTreeModel;

import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;

/**
 * Grid cell renderer which should be used especially to render just HTML.
 * 
 * @param <M>
 * @author Truong Chau Lien Ngoc (lienngoc@gmail.com)
 */
public interface HtmlGridCellRenderer<M extends AbstractTreeModel> extends GridCellRenderer<M> {

    /**
     * {@inheritDoc}
     */
    public String render(M model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<M> store,
            Grid<M> grid);

    /**
     * Sets the owner treegrid for this renderer to specify things such as row height.
     * <p>
     * This method would be called by {@link ch.elca.tf.fipo.gwt.client.core.widget.treegrid.AbstractTreeGrid} when it
     * creates column renderers.
     * 
     * @param ownerTree
     */
    void setOwnerTree(AbstractTreeGrid<M> ownerTree);

    /**
     * Returns the column holding this renderer.
     * 
     * @return Column configuration or <code>null</code> if this renderer hasn't been set to any column.
     */
    ColumnConfig getOwnerColumn();
}
